#!/bin/bash
proc() {
    echo -e "\033[42;32m > $@ \033[0m" >&2
    local command=("$@")
    if "${command[@]}"; then
        echo -e "\033[42;32m SUCCEED \033[0m \n" >&2
    else
        echo -e "\033[41;32m FAILED \033[0m \n" >&2
        exit 1
    fi
}

# begin first build:
    # cd ~/KzLab/v3s/u-boot
    # git clone https://github.com/Lichee-Pi/linux.git -b zero-5.2.y
    # CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm make licheepi_zero_defconfig
    # make ARCH=arm menuconfig
    # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
    # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs
# end 
# referd from https://whycan.com/t_561.html

proc cd ~/KzLab/v3s/u-boot
proc make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16

proc cd ~/KzLab/v3s/linux-zero-5.2.y
proc make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
proc make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs
# proc make -j16 modules
#proc spd-say "Compile Done"